<template>
  <div class="box">
    <van-nav-bar
      title="列表"
      left-arrow
      @click-left="$router.push('/classify')"
    />
    <van-tabs v-model="activename" @click="change">
      <van-tab
        v-for="index in $store.state.article.allCate"
        :title="index.catename"
        :key="index.id"
        :name="index.id"
      >
        <router-view></router-view>
      </van-tab>
    </van-tabs>
  </div>
</template>

<script>
import { mapState } from 'vuex'
export default {
  data () {
    return {
      activename: 8
    }
  },
  methods: {
    render () {
      // console.log(this.$params.id)
      // this.$store.dispatch('article/getdetails')
    },
    change (val) {
      console.log(val)

      this.activename = val
      this.$router.push(`/classlist/6337/pagelist/${val}`)
    }
  },
  created () {
    this.activename = +this.$route.params.id
    // console.log(this.activename)
    this.render()
  },
  computed: {
    ...mapState('article', ['articledetail'])
  }
}
</script>

<style scoped lang="less">
// 内容区域
.content {
  padding: 12px;
  // 用户名
  h4 {
    font-size: 24px;
  }
  // 用户信息
  .c-header {
    display: flex;
    align-items: center;
    // 头像
    img {
      width: 50px;
      height: 50px;
      border-radius: 50%;
    }
    p {
      margin-left: 10px;
      line-height: 10px;
    }
    .time {
      color: #ccc;
    }
  }
  // 正文结束分割线
  .end {
    color: #ccc;
    border-bottom: 1px solid #ccc;
    line-height: 0;
    text-align: center;
    span {
      padding: 0 10px;
      background-color: #fff;
    }
  }
}
.van-nav-bar {
  // position: fixed;
  width: 100vw;
  background-color: #003366;
  ::v-deep .van-nav-bar__title {
    font-size: 24px;
    color: #fff;
  }
}

.box {
  width: 100%;
}
</style>
